;; Flymake PYTHON Extension

(provide 'flymake-python)

(require 'flymake)

(defun flymake-pylint-init ()
  (let* ((temp-file (flymake-init-create-temp-buffer-copy
                     'flymake-create-temp-inplace))
         (local-file (file-relative-name
                      temp-file
                      (file-name-directory buffer-file-name))))
    (list "epylint" (list local-file))))


(add-to-list 'flymake-allowed-file-name-masks
             '("\\.py\\'" flymake-pylint-init))

(defun flymake-python-load ()
  (flymake-mode t)
  (textmate-mode t)
  (doxymacs-mode t)
  (local-set-key "\M-gp" 'flymake-goto-prev-error)
  (local-set-key "\M-gn" 'flymake-goto-next-error)
  (set (make-variable-buffer-local 'beginning-of-defun-function)
       'py-beginning-of-def-or-class)
  (setq py-smart-indentation nil)
  (setq tab-width 4)
  (setq-default py-indent-offset 4)
  (setq indent-tabs-mode nil))

;; (when (load "flymake" t) 
;;   (defun flymake-pyflakes-init () 
;; 	(let* ((temp-file (flymake-init-create-temp-buffer-copy 
;; 					   'flymake-create-temp-inplace)) 
;; 		   (local-file (file-relative-name 
;; 						temp-file 
;; 						(file-name-directory buffer-file-name)))) 
;;   (list "pyflakes" (list local-file)))) 
;;   (add-to-list 'flymake-allowed-file-name-masks 
;; 			   '("\\.py\\'" flymake-pyflakes-init))) 

;; (add-hook 'find-file-hook 'flymake-find-file-hook)
